﻿using System.Data;
using System.Windows.Forms;

namespace BLL
{
    public class Archives
    {
        public Archives()
        { }
        private readonly Aliyeye.Car.Net.Dal.Archives dal = new Aliyeye.Car.Net.Dal.Archives();
        public int Add(Model.Archives model)
        {
            return dal.Add(model);
        }
        public bool Update(Model.Archives model)
        {
            return dal.Update(model);
        }
        public bool Delete(int Id)
        {
            return dal.Delete(Id);
        }
        public Model.Archives GetModel(int Id)
        {
            return dal.GetModel(Id);
        }
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }
        public DataSet GetList()
        {
            return dal.GetList();
        }

        public DataSet ComBoxColor()
        {
            return dal.GetList("颜色");
        }
        public DataSet ComBoxBrand()
        {
            return dal.GetList("厂牌");
        }
        public DataSet ComBoxCar()
        {
            return dal.GetList("车型");
        }
        public DataSet ComBoxSit()
        {
            return dal.GetList("座位数");
        }
        public DataSet ComBoxCarX()
        {
            return dal.GetList("准驾车型");
        }
        public DataSet ComBoxIllegal()
        {
            return dal.GetList("违章类型");
        }
        public DataSet ComBoxCompany()
        {
            return dal.GetList("修理厂");
        }
        public DataSet ComBoxMakeType()
        {
            return dal.GetList("维修类型");
        }
        public DataSet ComBoxQx()
        {
            return dal.GetList("权限类型");
        }
        public void ComBoxMT(ComboBox combox, string str)
        {
            DataTable dt = dal.GetList(str).Tables[0];
            combox.DisplayMember = "Namevalue";
            combox.DataSource = dt;
        }
        public void ComBoxMT(ComboBox combox)
        {
            DataTable dt = dal.GetList("主管单位").Tables[0];
            combox.DisplayMember = "Namevalue";
            combox.DataSource = dt;
        }

        public DataSet ComBoxMT()
        {
            return dal.GetList("主管单位");
        }
        public DataSet ComBoxPay()
        {
            return dal.GetList("付款方式");
        }

        public DataSet ComBoxCarkind()
        {
            return dal.GetList("车种");
        }

        public float GetPointsRate()
        {
            DataSet ds = dal.GetList("会员积分比率");
            if (ds != null)
            {
                return float.Parse(ds.Tables[0].Rows[0][2].ToString());
            }
            else
            {
                return 0;
            }
        }

        public bool UpdatePointRate(string strPointRate)
        {
            return dal.UpdatePointRate(strPointRate);
        }
    }
}
